package com.winit.cloudlink.mgmt.rabbit;

import com.winit.cloudlink.common.URL;
import com.winit.cloudlink.rabbitmq.mgmt.RabbitMgmtService;
import com.winit.cloudlink.rabbitmq.mgmt.model.shovel.ShovelLink;
import com.winit.cloudlink.rabbitmq.mgmt.model.shovel.ShovelOptions;

import java.util.Collection;


/**
 * Created by stvli on 2017/3/31.
 */
public class ShovelAdmin extends BaseAdmin {
    public ShovelAdmin(String url) {
        super(url);
    }

    public ShovelAdmin(URL url) {
        super(url);
    }

    public ShovelAdmin(RabbitMgmtService rabbitMgmtService, String virtualHost) {
        super(rabbitMgmtService, virtualHost);
    }

    public Collection<ShovelLink> queryShovleLinks() {
        return rabbitMgmtService.shovel().links();
    }

    public void createShovel(String shovelName, ShovelOptions shovelOptions) {
        rabbitMgmtService.shovel().establishConnection(shovelName, shovelOptions);
    }

    public void deleteShovel(String shovelName) {
        rabbitMgmtService.shovel().deleteConnection(shovelName);
    }
}
